﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace TestOnlineProject.Models.Entities
{
    public class DiscussionModel
    {
        public Discussion Discussion { get; set; }
        public User User { get; set; }
        public Subject Subject { get; set; }
        public List<DiscussionModel> Replies { get; set; }
        public int TotalReplies { get; set; }
        public int LastDiscussion { get; set; }
        public string LastUser { get; set; }
        public string LastPost { get; set; }
        public bool OnTop { get; set; }

        public DiscussionModel()
        {
            Replies = new List<DiscussionModel>();
        }
    }

    public class DiscussionCreateModel
    {
        public int SubjectId { get; set; }

        [StringLength(100, MinimumLength = 5, ErrorMessage = "Title must be between 5 an 100 character long!")]
        [Required(ErrorMessage = "Please input Title of Discussion!")]
        public string Title { get; set; }

        [Required(ErrorMessage = "Please input Content of Discussion!")]
        public string Content { get; set; }
    }
}